package com.czbgradefive.shop.controllradvice;

import com.czbgradefive.common.core.domain.Result;
import com.czbgradefive.shop.exception.ShopException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author：作者姓名
 * @Package：com.czbgradefive.shop.controllradvice
 * @Project：RuoYi-Cloud
 * @name：ExceptionResult
 * @Date：2024/5/6 19:13
 */
@RestControllerAdvice
public class ExceptionResult {
    @ExceptionHandler(value = ShopException.class)
    public Result error(ShopException e){
        return Result.error(e.getMessage());
    }
}
